package data_operations;

public class QuickSort {
	
	public int[][] Sort(int tab[][], int x, int y) {
		
		int tmp, tmp2, v, i, j;
		i = x;
		j = y;
		v = tab[(x + y)/2][0];
		
		do {
			while (tab[i][0] > v)
				i++;
			while (v > tab[j][0])
				j--;
			if (i <= j) {
				tmp = tab[i][0];
				tmp2 = tab[i][1];
				tab[i][0] = tab[j][0];
				tab[i][1] = tab[j][1];
				tab[j][0] = tmp;
				tab[j][1] = tmp2;
				i++;
				j--;
			}
		}
		while (i <= j);
			if (x < j)
				Sort(tab, x, j);
			if (i < y)
				Sort(tab, i, y);
		
		
		return tab;
	}

}
